package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class SimpleConnection {
	private static SimpleConnection sc;     
    private SimpleConnection (){}   
    public static SimpleConnection getInstance(){
            if(sc==null) {
                    sc = new SimpleConnection();
            }
            return sc;      
    }
    
    
public Connection getConnection() {
    Connection maConnection = null ;
    
    //ChargeProperty p = null ;
    //p.getInstance();
    
    final String driver="sun.jdbc.odbc.JdbcOdbcDriver";
    final String URL = "jdbc:odbc:aquarium" ;
    
    //final String driver = p.getPropriete(driver);
    //final String URL = p.getPropriete(url) ;
    
    try
    {
            Class.forName(driver);
            maConnection=DriverManager.getConnection(URL);
    }
    catch(ClassNotFoundException cnf)
    {
            
    }
    catch(SQLException se)
    {
            se.printStackTrace();
    }
    return maConnection ;
}
    
    
public static void main(String[] args) {
    Connection col = null ;
    try {
            col = SimpleConnection.getInstance().getConnection();
    }
    catch(Exception e)
    {
    	
    }
    System.out.println("-->Simple Connection : "+col.toString()) ;
}
}
